from metadrive.engine.engine_utils import close_engine
close_engine()
from metadrive.envs.metadrive_env import MetaDriveEnv
from metadrive.examples import expert

import gymnasium as gym

env = MetaDriveEnv(config={"use_render": False})

print(f'The action space is {env.action_space}')
print(f'The observation space is {env.observation_space}')
try:
    obs, info = env.reset()
    for i in range(1000):
        env.step(env.action_space.sample())
    print("Successfully run MetaDrive")
except:
    raise ValueError("Fail to run MetaDrive")
finally:
    env.close()

